#!/usr/bin/env python
#coding:utf-8
# author : wangwei
# mail   ：alsww@qq.com
# oldboy s10 python training

import time

#取现函数
def withDraw(u,m):
    print "您好 %s, 您当前的账户有 %d 元." %(u,m)
    print "如果您取现金，将收取5%的手续费!"
    global draw_money
    draw_money = int(raw_input("请输入您要取现金的金额:"))
    m = m - draw_money * 1.05
    #记入日志文件
    withdrawInfo(u,draw_money)
    return m
#取现记入日志
def withdrawInfo(user,withdraw):
    shouxufei = draw_money * 0.05
    transfer_time=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
    p = "record_list.txt"
    f = open(p,'a')
    f.write("%s|%s|withdraw|%d|%d  \n" %(user,transfer_time,withdraw,shouxufei))
    f.close()